-# locals: risk

-model_name = controller_name.singularize
-model_title = controller_name.singularize.titleize
-instance = instance_variable_get("@" + model_name)
-content_for :widget_title do
  Attributes linked to this Risk

-content_for :widget_help, "#{model_name}_risky_attributes"

-content_for :widget_id, "#{model_name}_risky_attributes_widget"

-content_for :widget_buttons do
  .filter
    .row-fluid
      .span12
        %a.pull-right.secondary-link{:href => list_edit_flow_risk_risky_attributes_path(:risk_id => instance.id), :'data-toggle' => 'modal-ajax-relationship-selector', :'data-modal-reset' => 'reset', :'data-list-target' => 'refresh', :'data-modal-class' => 'modal-wide', :rel => "tooltip", :title => "Link attributes to this Risk", :'data-placement'=>"left" }
          %i.grcicon-link

-risky_attributes = instance.risky_attributes

-#.row-fluid.js-list-container-title
  .span10
    %h3.toggle{"data-target" => "#riskyAttributeListCollapse", "data-toggle" => "collapse"}
      .expander
      Risky Attributes
      %span{:class => "grc-badge #{risky_attributes.count.zero? ? "no-object" : ""}"}=risky_attributes.count
  .span2
    %a.widgetbtn.pull-right.juke-left{:href => list_edit_flow_risk_risky_attributes_path(:risk_id => instance.id), :'data-toggle' => 'modal-ajax-relationship-selector', :'data-modal-reset' => 'reset', :'data-list-target' => '#risky_attributeList', :'data-modal-class' => 'modal-wide' }
      %i.grcicon-edit

.collapse.in#riskyAttributeListCollapse
  .bootstrap-collapse-bugfix

  %script#risky_attribute_list_item{ :type => 'text/html', :'data-member' => 'risk_risky_attribute' }
    %li.main
      .item-identifier
        %a{ :'data-id' => '<%= risky_attribute.id %>', :href => flow_risky_attribute_path("<%=risky_attribute.id%>"), :'data-popover-href' => tooltip_flow_risky_attribute_path("<%=risky_attribute.id%>"), :'data-popover-trigger' => 'sticky-hover' }
          %span.addition-info
            <%= risky_attribute.title || '' %>
          %span.code
            <%= risky_attribute.type_string %>

  %ul#risky_attributeList.tree-structure.simple{ :'data-template-id' => 'risky_attribute_list_item' }
    -risky_attributes.each do |item|
      %li
        .item-main
          .item-title
            .row-fluid
              .span12
                %a{ :'data-id' => item.id, :href => flow_risky_attribute_path(item.id), :class => "block-element", :'data-popover-href' => tooltip_flow_risky_attribute_path(item.id), :'data-popover-trigger' => 'sticky-hover'}
                  .oneline
                    %i{:class => "grcicon-#{item.type_string.downcase}-color"}
                    =item.title || '&nbsp;'.html_safe
            
